<?php

namespace app\controller;

use ali\Sms;
use app\BaseController;
use app\model\PlateformCode;
use app\Qrcode;
use payment\Hpay;
use think\helper\Str;

class Index extends BaseController
{
    public function index()
    {
//        echo (captcha_img());
//        exit;
        $data = setPassword("123456");
//        dd($data);
//        dd(checkPassword("123456",$data['encode'],$data['password']));
        return redirect("/sys");
//        return '<style>*{ padding: 0; margin: 0; }</style><iframe src="https://www.thinkphp.cn/welcome?version=' . \think\facade\App::version() . '" width="100%" height="100%" frameborder="0" scrolling="auto"></iframe>';
    }

    public function hello($name = 'ThinkPHP8')
    {
        return 'hello,' . $name;
    }

    public function test()
    {
//        $this->app->make(Sms::class)
        $data = Sms::sendSms("18328378446",['code'=>123456],'SMS_474460088',"富海科技");
        return json($data);
//        return json($this->app->make(PlateformCode::class)->codeDetail());
//        $qrcode = $this->app->make(Qrcode::class);
//        $code = $qrcode->createQrcode("https://www.baidu.com",120);
//        $label = $qrcode->createLabel("123456");
//        return $qrcode->files($code,null,$label);
    }
    public function images()
    {
//        echo "<img src='https://jz.verjs.cn/index/test'/>";
    }

    public function payTest()
    {
        $data = $this->app->make(Hpay::class)->createPayOrder([
            "outTradeNo"=>Str::random(24),
            "transType"=> "JSAPI",
            "payMode"=>"WECHAT",
            "totalAmount"=>"0.01",
            "profitSharing"=>"0",
            "subject"=>"测试",
            "userId"=>"oxO4n6VAxmjNIR_U5Y31MhNmd6Ko"
        ]);
        dd($data);
    }
}
